﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

using YLServerInterface.GlobalClass;
using YLServiceCLient.YLAdminClient;
using YLPublicService.TransferModel;

namespace YLServerInterface.NavigateWindows
{
    /// <summary>
    /// Interaction logic for Main.xaml
    /// </summary>
    public partial class Main : Page
    {
        AdminServiceClient sc = AdminServiceClient.GetServiceClient();
        public Main()
        {
            this.DataContext = client.GetUsers(sc.loginSuccessGuid);
            InitializeComponent();
        }
        AdminServiceClient client = AdminServiceClient.GetServiceClient();

        private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            var user = (e.OriginalSource as Button).DataContext as User;

            var items = client.GetWorkItems(user.LoginName, sc.loginSuccessGuid);

            UserItemsPage itemPage = new UserItemsPage(items);
            NavigationService.Navigate(itemPage);
        }
    }
}
